<?php
	class PublicAction extends Action
	{
		public function Top()
		{
			if(!Session::is_set('login'))
				Session::set('login', false);
			/*if(!Session::is_set('login'))
			{
				echo('Session Reset');
				Session::set('login', false);
			}
			if(Session::get('login') == false)
			{
				$this -> assign('UserName', '游客');
				$this -> assign('LogURLS', );
			}
			else
			{
				$this -> assign('UserName', Session::get('UserName'));
				$this -> assign('LogURLS', );
			}*/
			//DO NOT TRY TO CHANGE TEMPLATE. Template is intend for Compiling.
			//Use PHP Code instead.
			$navi = array(
				array(
					"URL"			=>	U('Index/index'),
					"description"	=>	'首页'),
				array(
					"URL"			=>	U('Core/TDX'),
					"description"	=>	'TDX指数'),
				array(
					"URL"			=>	U('Empty/index'),
					"description"	=>	'预测擂台'),
				array(
					"URL"			=>	U('Core/searchindex'),
					"description"	=>	'净值查询'),
				array(
					"URL"			=>	U('Fund/noticeView'),
					"description"	=>	'事务公示'),
				array(
					"URL"			=>	U('Empty/index'),
					"description"	=>	'经理管理'),
				array(
					"URL"			=>	U('Index/about'),
					"description"	=>	'关于我们'),
				array(
					"URL"			=>	U('Index/search'),
					"description"	=>	'站内搜索')
				);
				$this -> assign('IndexURLS', $navi);
			
		}
		public function Bottom()
		{
		}
		public function _initialize()
		{
			$this -> Top();
			$this -> Bottom();
		}
		public function TopAjax()
		{	
			if($_SESSION['login'] == false)
				echo('<div class="usertext" style="margin-right:10px">游客   您好！请</div> '.'<div class="column grid_3" style="text-align:center">'.'<div class="headerlink"><a href = "'.U('Register/index').'" class="headera">'.'注册'.'    '.'</a></div>'.'<div class="headerlink"><a class="headera" href = "'.U('User/login').'">'.'登录'.'    '.'</a></div></div>');
			else
				echo('<div class="usertext" style="margin-right:10px;white-space:normal">'.$_SESSION['UserName'].'<br/>您好！欢迎回来</div> '.'<div class="column grid_3" style="text-align:center">'.'<div class="headerlink"><a class="headera" href = "'.U('User/info').'">'.'个人中心'.'    '.'</a></div>'.'<div class="headerlink"><a class="headera" href = "'.U('User/logout').'">'.'注销登录'.'    '.'</a></div></div>');
		}
		protected function _verifyPrivilege($level)
		{
			if($_SESSION['login'] == false)
			{
				$this -> error('请登录或注册后执行此操作！');
			}
			if($_SESSION['PLevel'] < $level)
			{
				$this -> error('您没有此操作权限，详情请联系TDX基金经理！');
			}
		}
                
                public function _empty()
                {
                    $this -> error("您请求的页面不存在或者正在建设中，请稍后再试~");
                }
	}
?>